/**************************************************************************************************
* Title: SimulationManager.h
* Authors: Gael Huber
* Description: Manages the actual game
**************************************************************************************************/
#ifndef __SIMULATIONMANAGER_H__
#define __SIMULATIONMANAGER_H__

#include <stdio.h>
#include <time.h>
#include <Windows.h>
#include <vector>

#include "SmurfsEntity.h"
#include "SmurfsRenderManager.h"
#include "SmurfsPhysicsManager.h"
#include "SmurfsInputManager.h"
#include "SmurfsSingleton.h"
#include "SmurfsMatrixReader.h"
#include "SmurfsBezierSurface.h"

#define MAX_ENTITIES 750

class SimulationManager : public Singleton<SimulationManager> {
public:
	SimulationManager(void);	// Constructor
	~SimulationManager(void);	// Destructor

	void startUp(void);	// Initialize
	void shutDown(void);	// Shutdown

	static SimulationManager& getSingleton(void);	// Get the singleton instance
	static SimulationManager* getSingletonPtr(void);	// Get the singleton pointer

	void gameLoop(void);	// Update

	void createSpecificEntity(void);	// Add an entity in the center of the screen close to the front (for mouse click)
	void increaseRotationSpeed(void);		// Doubles the rotation speed of all entities in the world
	void decreaseRotationSpeed(void);		// Halves the rotation speed of all entites in the world
	void increaseVelocity(void);			// Doubles the velocity of all entities in the world
	void decreaseVelocity(void);			// Half the velocity of all entities in the world

	int getNumEntities(void);	// returns the number of entities in the world
private:
	void createRandomEntity(void);			// Create an entity with a random position
	void createEntity(Vector3 position);	// Create an entity based on its position
	void adjustHeight(Entity* ent);				// Adjust the height of the sphere in accordance with the map

	std::vector<Entity*> entityList;	// all entities on the screen

	// smurfs managers (singletons)
	RenderManager* renderManager;
	PhysicsManager* physicsManager;
	InputManager* inputManager;
	MatrixReader* matrixReader;
	
	int numEntities;		// the number of entities in the world

	BezierSurface* surface;	// Bezier surface -- test
	Entity* sphere;			// sphere -- test
};

#endif